/****************************************************
          File Name:gettimeofday.c
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Mon 11 Aug 2014 09:38:46 AM CST
*****************************************************/

#include<stdio.h>
#include<sys/time.h>

int main()
{
    fprintf(stdout,"%s\b","the time of day is :");
    struct timeval tv;
    gettimeofday(&tv,NULL);
    
    printf("seconds: %ld  microseconds: %lld\n",tv.tv_sec,(long long)tv.tv_usec);
    
    int year;
    
    year=tv.tv_sec/(3600*24*365);
    
    printf("the year since 1970 is  :  %d\n",year);
    
    return 0;
}
